VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form buscar 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "BUSQUEDA"
   ClientHeight    =   3285
   ClientLeft      =   45
   ClientTop       =   420
   ClientWidth     =   7440
   BeginProperty Font 
      Name            =   "Verdana"
      Size            =   9.75
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3285
   ScaleWidth      =   7440
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txt_reg 
      Height          =   360
      Left            =   600
      TabIndex        =   8
      Top             =   2040
      Visible         =   0   'False
      Width           =   5295
   End
   Begin VB.CheckBox chk_fecha 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   120
      TabIndex        =   7
      Top             =   2520
      Width           =   255
   End
   Begin VB.CheckBox chk_registro 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   1680
      Width           =   255
   End
   Begin VB.CheckBox chk_cliente 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   360
      Width           =   255
   End
   Begin VB.ComboBox cmb_cliente 
      Height          =   360
      ItemData        =   "buscar.frx":0000
      Left            =   600
      List            =   "buscar.frx":000A
      TabIndex        =   3
      Top             =   1200
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.CommandButton cmd_buscar 
      Caption         =   "Buscar"
      Height          =   360
      Left            =   1680
      TabIndex        =   2
      Top             =   3360
      Width           =   1335
   End
   Begin VB.TextBox txt_nombre 
      Height          =   360
      Left            =   2160
      TabIndex        =   1
      Top             =   1200
      Visible         =   0   'False
      Width           =   3735
   End
   Begin MSComCtl2.DTPicker dtp_desde 
      Height          =   315
      Left            =   1320
      TabIndex        =   11
      Top             =   2880
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      CalendarBackColor=   16711647
      CalendarForeColor=   -2147483646
      CalendarTitleBackColor=   -2147483635
      CalendarTitleForeColor=   16777215
      CalendarTrailingForeColor=   -2147483635
      Format          =   21889025
      CurrentDate     =   36526
      MaxDate         =   2958131
      MinDate         =   36526
   End
   Begin MSComCtl2.DTPicker dtp_hasta 
      Height          =   315
      Left            =   3600
      TabIndex        =   14
      Top             =   2880
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      CalendarBackColor=   16711647
      CalendarForeColor=   -2147483646
      CalendarTitleBackColor=   -2147483635
      CalendarTitleForeColor=   16777215
      CalendarTrailingForeColor=   -2147483635
      Format          =   21889025
      CurrentDate     =   36526
      MaxDate         =   2958131
      MinDate         =   36526
   End
   Begin VB.Label Label6 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Desde:"
      Height          =   255
      Left            =   600
      TabIndex        =   13
      Top             =   2880
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Hasta:"
      Height          =   255
      Left            =   2880
      TabIndex        =   12
      Top             =   2880
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Por nro. de registro"
      Height          =   255
      Left            =   840
      TabIndex        =   10
      Top             =   1680
      Width           =   2175
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Por fechas de muestreo"
      Height          =   255
      Left            =   840
      TabIndex        =   9
      Top             =   2520
      Width           =   2535
   End
   Begin VB.Image Image3 
      Height          =   270
      Left            =   480
      Picture         =   "buscar.frx":0020
      Stretch         =   -1  'True
      Top             =   1680
      Width           =   285
   End
   Begin VB.Image Image2 
      Height          =   270
      Left            =   480
      Picture         =   "buscar.frx":0438
      Stretch         =   -1  'True
      Top             =   2520
      Width           =   285
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Por apellido paterno cliente o nombre de la empresa"
      Height          =   255
      Left            =   840
      TabIndex        =   4
      Top             =   360
      Width           =   5295
   End
   Begin VB.Image Image1 
      Height          =   270
      Left            =   480
      Picture         =   "buscar.frx":0850
      Stretch         =   -1  'True
      Top             =   360
      Width           =   285
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Por favor seleccione e introduzca los datos"
      Height          =   255
      Left            =   600
      TabIndex        =   0
      Top             =   840
      Visible         =   0   'False
      Width           =   4335
   End
End
Attribute VB_Name = "buscar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
dtp_desde.Year = Year(Now)
dtp_desde.Month = Month(Now)
dtp_hasta.Year = Year(Now)
dtp_hasta.Month = Month(Now)
'*-*- modificar posicion controles de busqueda
'segundo check
With chk_registro
.Left = 120
.Top = 840
End With
With Image3
.Left = 480
.Top = 840
End With
With Label5
.Left = 840
.Top = 840
End With
'tercer check
With chk_fecha
.Left = 120
.Top = 1200
End With
With Image2
.Left = 480
.Top = 1200
End With
With Label4
.Left = 840
.Top = 1200
End With
buscar.Height = 2050
cmb_cliente.ListIndex = 0
End Sub
Private Sub chk_cliente_Click()
If chk_cliente.Value = 1 Then
Label1.Visible = True
cmb_cliente.Visible = True
cmb_cliente.ListIndex = 0
txt_nombre.Visible = True
 If chk_registro.Value = 1 Then
  chk_registro.Value = 0
 ElseIf chk_fecha.Value = 1 Then
  chk_fecha.Value = 0
 End If
'segundo check
With chk_registro
.Left = 120
.Top = 1680
Image3.Left = 480: Image3.Top = 1680
Label5.Left = 840: Label5.Top = 1680
End With
With chk_fecha
.Left = 120
.Top = 2040
Image2.Left = 480: Image2.Top = 2040
Label4.Left = 840: Label4.Top = 2040
End With
cmd_buscar.Left = 6000: cmd_buscar.Top = 1200: cmd_buscar.Visible = True
buscar.Height = 2850

Else
 'si los 3 son blancos
 If chk_cliente.Value = 0 And chk_registro.Value = 0 And chk_fecha.Value = 0 Then
 Label1.Visible = False: cmb_cliente.Visible = False: txt_nombre.Visible = False
 With chk_registro
 .Left = 120
 .Top = 840
 Image3.Left = 480: Image3.Top = 840
 Label5.Left = 840: Label5.Top = 840
 End With
 With chk_fecha
 .Left = 120
 .Top = 1200
 Image2.Left = 480: Image2.Top = 1200
 Label4.Left = 840: Label4.Top = 1200
 End With
 cmd_buscar.Visible = False
 buscar.Height = 2050
 
 Else '/*/*/*/- BLANCO Y SELECCIONA OTRO
  If chk_cliente.Value = 0 Then
  Label1.Visible = False: cmb_cliente.Visible = False: txt_nombre.Visible = False
  cmb_cliente.Text = "": txt_nombre.Text = "": cmd_buscar.Visible = False
  End If
  chk_registro.Left = 120: chk_registro.Top = 840
  Image3.Left = 480: Image3.Top = 840: Label5.Left = 840: Label5.Top = 840

 End If
 'si es blanco
 
End If

End Sub
Private Sub chk_registro_Click()
Select Case chk_registro.Value
Case Is = 1 'activo
'si los dos anteriores estan en blanco
 If chk_cliente.Value = 1 Then
  chk_cliente.Value = 0
 ElseIf chk_fecha.Value = 1 Then
  chk_fecha.Value = 0
 End If
 With chk_registro
 .Left = 120
 .Top = 840
 Image3.Left = 480: Image3.Top = 840
 Label5.Left = 840: Label5.Top = 840
 txt_reg.Left = 600: txt_reg.Top = 1200: txt_reg.Visible = True: txt_reg.Text = ""
 cmd_buscar.Left = 6000: cmd_buscar.Top = 1200: cmd_buscar.Visible = True
 End With
 With chk_fecha
 .Left = 120
 .Top = 1650
 Image2.Left = 480: Image2.Top = 1650
 Label4.Left = 840: Label4.Top = 1650
 End With
 buscar.Height = 2550 '2950
Case Is = 0 'inactivo
 If chk_cliente.Value = 0 And chk_fecha.Value = 0 Then
 With chk_fecha
  .Left = 120
  .Top = 1200
  Image2.Left = 480: Image2.Top = 1200
  Label4.Left = 840: Label4.Top = 1200
 End With
 txt_reg.Visible = False: txt_reg.Text = ""
 cmd_buscar.Visible = False
 buscar.Height = 2050
 Else
 
 With chk_registro
 .Left = 120
 .Top = 840
 Image3.Left = 480: Image3.Top = 840
 Label5.Left = 840: Label5.Top = 840
 txt_reg.Visible = False: txt_reg.Text = ""
 cmd_buscar.Visible = False
 End With
 End If
 
End Select
End Sub
Private Sub chk_fecha_Click()
Select Case chk_fecha
Case Is = 1 'activo
 If chk_cliente.Value = 1 Then
 chk_cliente.Value = 0
 ElseIf chk_registro.Value = 1 Then
  chk_registro.Left = 120: chk_registro.Top = 840
  Image3.Left = 480: Image3.Top = 840: Label5.Left = 840: Label5.Top = 840
  chk_registro.Value = 0
 End If
 With chk_fecha
 .Left = 120
 .Top = 1200
 Image2.Left = 480: Image2.Top = 1200
 Label4.Left = 840: Label4.Top = 1200
 End With
 Label6.Left = 600: Label6.Top = 1600: Label6.Visible = True
 dtp_desde.Left = 1320: dtp_desde.Top = 1600: dtp_desde.Visible = True
 dtp_hasta.Left = 3600: dtp_hasta.Top = 1600: dtp_hasta.Visible = True
 Label2.Left = 2880: Label2.Top = 1600: Label2.Visible = True
 cmd_buscar.Visible = True: cmd_buscar.Left = 6000: cmd_buscar.Top = 1600
 buscar.Height = 2550
Case Is = 0 'inactivo

If chk_cliente.Value = 0 And chk_registro.Value = 0 Then
 Label6.Visible = False: dtp_desde.Visible = False
 dtp_hasta.Visible = False: Label2.Visible = False
 cmd_buscar.Visible = False: buscar.Height = 2050
Else
 Label6.Visible = False: dtp_desde.Visible = False
 dtp_hasta.Visible = False: Label2.Visible = False
 cmd_buscar.Visible = False
End If


End Select
End Sub
Private Sub cmd_buscar_Click()
Dim cod As String, band As Integer

If chk_cliente.Value = 1 Then
 If txt_nombre.Text <> "" Then
  Select Case cmb_cliente.ListIndex
  Case Is = 0 'empresa
   cod = devolverCod(" DISTINCT cod_empresa as cod", "empresa", "nombre='" & txt_nombre.Text & "'", 0)
   band = 1
  Case Is = 1 'cliente
   cod = devolverCod(" DISTINCT codigo as cod", "datos_persona", "apellido_pat='" & txt_nombre.Text & "'", 0)
   band = 2
  End Select
 Else
  Call mensajes(7)
 End If
 
 cadParametros = devolverBusqueda(cod, band)
 If cadParametros = "0" Then
 Call mensajes(7)
 Else
 Unload Me: listabuscar.Show
 End If
 'cadParametros = band & "+" & cod:  Unload Me: If bandReporte <> 1 Then listabuscar.Show
 
ElseIf chk_registro.Value = 1 Then 'registro
 If txt_reg.Text <> "" Then
 'cod = devolverCod(" DISTINCT cod_protocolo as cod", "protocolo", "nro_reg='" & txt_reg.Text & "'", 0)
  cadParametros = devolverBusqueda(txt_reg.Text, 4)
  If cadParametros = "0" Then
  Call mensajes(7)
  Else
  Unload Me: tickel1.Show
  End If
 End If
ElseIf chk_fecha.Value = 1 Then 'fechaas

cod = dtp_desde.Year & "-" & dtp_desde.Month & "-" & dtp_desde.Day & "*" & dtp_hasta.Year & "-" & dtp_hasta.Month & "-" & dtp_hasta.Day
cadParametros = devolverBusqueda(cod, 3)
If cadParametros = "0" Then
 Call mensajes(7)
 Else
 Unload Me: listabuscar.Show
 End If
'band = 3
''cadParametros = 3 & "," & cod: Unload Me: If bandReporte <> 1 Then listabuscar.Show
End If

End Sub

